package com.runtime.hongyunmanage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.runtime.hongyunmanage.bean.Categories;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Locale;

@Mapper
public interface CategoryMapper extends BaseMapper<Categories> {

    int countSameNameCategory(@Param("parentId") Long parentId, @Param("categoryName") String categoryName);

    List<Categories> getCategoryListByParentId(@Param("parentId") Long parentId);

    List<Categories> getCategoryListByKeyword(@Param("keyword") String keyword);

    int countChildCategories(@Param("categoryId") Long categoryId);

    int countRelatedProducts(@Param("categoryId") Long categoryId);

    List<Categories> getCategoryTree(@Param("parentId") Long parentId);

    List<Categories> getCategoryTreeAll();

//    boolean countSameNameCategory(Categories category);

    boolean save(Categories category);

    int deleteCategoryimage(@Param("categoryId") Long categoryId,
                            @Param("imageUrl") String imageUrl);
}